<style type="text/css">
body{background:#eee}
.storelogo img{width:3.2rem;height:3.2rem}
.merchgroup .store-star {padding:0.1rem 0 0.2rem 0;font-size:0.55rem;line-height:1rem}
.merchgroup .store-star img{height:0.66rem}
.star-on,.star-off{position:absolute;top:1rem;left:0;overflow:hidden}
.star-rate {margin-left:3.6rem}
.store-distance{float:right;color:#999}
.store-moneylimit{font-size:0.55rem}
.weui_cell_hd {
    padding: 0.6rem;
	padding-left: 0;
}
.weui_cells_text {padding:0 10px;padding-top:10px}
p {
    margin: 0 0 2px;
}
.fui-number .minus:before, .fui-number .plus:before {
	border-left: 0 solid #d9d9d9;
}
.fui-number .minus:after, .fui-number .plus:after {
	border-right: 0 solid #d9d9d9;
}
.fui-number:before {
	border-top: 0 solid #d9d9d9;
}
.fui-number:after {border-top: 0 solid #d9d9d9;}
.fui-number .num {
	color:#666;
}
.fui-number .num {
	color:#666;
}
.fui-number.small {
	height: 1.2rem;
	width: 3.6rem;
	line-height: 1.2rem;
}
.fui-number .minus, .fui-number .plus {
	z-index:0;
}
.fui-number.small .minus{
	color: {{main.syscolor || '#63BE72'}};
	padding-top:1px;
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
 .fui-number.small .plus {
	color: #fff;
	padding-top:1px;
	background: {{main.syscolor || '#63BE72'}};
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
.parent-category{float:left; width:100%; height:auto; min-height:100%;}
.parent-category ul{margin:0; padding:0; width:100%;}
.parent-category ul li{list-style:none; text-align:center; height:50px; line-height:50px; white-space:nowrap; width:100%; border-bottom:1px solid #e0e0e0; position:relative; right:-1px;}
.parent-category ul li.active{border-right:1px solid #fff; z-index: 10000}
.parent-category ul li a{color:#333; display:inline-block; width:100%; height:100%; text-decoration:none;}
.parent-category ul li.active a{color:#09ba07;}
.children-category{width:100%; min-height:100%; height:auto; color: #252525;}
.children-category ul{list-style:none; margin:0; padding:0; overflow-y:auto; overflow-x:hidden; border-left:1px solid #e0e0e0; min-height:100%;}
.children-category ul li{text-align:left; height: 32px; line-height: 32px; padding-left: 15px}
.children-category ul li.delivery-tips{height:25px; line-height:25px; margin-top: -15px; font-size: .65rem; color: #ff2d4b}
.children-category ul li a{display:inline-block; width:100%; height:100%; text-decoration:none; color:#333;}
.children-category ul li a span{font-size: .6rem; color: #999;}
.children-category .block{display:block; color:#ef1e15; font-size:.6rem;}
</style>
<div class="fui-page order-create-page fui-page-current" ng-if="pagedata.op == 'main'">
	 <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">确认预定</div>
		<div class="fui-header-right"></div>
	</div>
	<div class="fui-content">
		<div class="weui_cells">
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary">
                    <span>预定{{pagedata.yuyue_typetitle}}</span>
                </div>
                <div class="weui_cell_ft">[{{pagedata.group.title}}]{{pagedata.table.title}}</div>
        </div>
		<div class="weui_cell" href="javascript:;" ng-click="pagedata.selecttime();">
                <div class="weui_cell_hd weui_cell_primary">
                    <span>预定时间</span>
                </div>
                <div class="weui_cell_ft">{{pagedata.post.dayname}} {{pagedata.post.out_time || '点击选择时间'}}</div>
        </div>
		<div ng-if="pagedata.group.pay>0" class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary">
                    <span>预定定金</span>
                </div>
                <div class="weui_cell_ft">{{pagedata.group.pay || '0.00'}}元</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary">
                    <span>预约人数</span>
                </div>
                <div class="weui_cell_ft">
					<div class="fui-number small">
						<div ng-if="pagedata.post.total>1" class="minus" ng-click="pagedata.minus()"><i class="icon icon-subtract" style="font-size:0.7rem"></i></div>
						<div ng-if="pagedata.post.total==1" class="minus disabled"><i class="icon icon-subtract" style="font-size:0.7rem"></i></div>
						<input class="num shownum" type="text" ng-model="pagedata.post.total" style="width:50px" ng-change="pagedata.refresh()"/>
						<div class="plus" ng-click="pagedata.plus()"><i class="icon icon-tianjia" style="font-size:0.7rem"></i></div>
					</div>
				</div>
        </div>
		</div>
		<div class="weui_cells weui_cells_form">
				<div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">联系人</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input ng-model="pagedata.post.username" class="weui_input" type="text" placeholder="请输入联系人">
                </div>
                </div>
				<div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">联系电话</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input ng-model="pagedata.post.mobile" value="{{pagedata.post.mobile}}" class="weui_input" type="text" placeholder="请输入电话">
                </div>
                </div>
        </div>
		<div ng-repeat="item in pagedata.post.fileds">
			<div class="weui_cells weui_cells_form">
				<div class="weui_cell" ng-if="item.type == 1">
					<div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="text" ng-model="item.data" placeholder="输入{{item.title}}内容">
					</div>
				</div>
				<div class="weui_cell" ng-if="item.type == 2">
					<div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="number" ng-model="item.data" placeholder="输入{{item.title}}内容">
					</div>
				</div>
				<div class="weui_cell" ng-if="item.type == 3">
					<div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<ul class="weui_uploader_files" ng-if="item.data">
							  <li class="weui_uploader_file" style="background-image:url({{tomedia(item.data)}})"></li>
						</ul>
						<div class="weui_uploader_input_wrp">
							 <input class="weui_uploader_input" ng-click="up_file(item,'data','image')" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
						</div>
					</div>
				</div>
				<div ng-if="item.type == 4" class="weui_cells_title">{{item.title}}</div>
				<div ng-if="item.type == 4" class="weui_cells weui_cells_radio2">
						<label class="weui_cell weui_check_label dashed" ng-repeat="(key,value) in item.value">
							<div class="weui_cell_bd weui_cell_primary">
								<span style="float:left;width:100%">{{value}}</span>
							</div>
							<div class="weui_cell_ft" href="javascript:;"  ng-click="item.data=value;">
								<input type="radio" class="weui_check" name="radio1">
								<span class="weui_icon_checked"></span>
							</div>
						</label>
				</div>	
				<div ng-if="item.type == 5" class="weui_cells_title">{{item.title}}</div>
				<div ng-if="item.type == 5" class="weui_cells weui_cells_checkbox" style="padding:0.5rem">
						<div class="fui-cell-label" style="margin-right:0.8rem;float:left;margin-bottom:0.2rem" ng-repeat="(key,value) in item.value">
							<input type="checkbox" ng-click="duoxuans(value,item,'data')" class="fui fui-checkbox fui-checkbox-danger verify-checkbox" value="{{key}}" id="s11"> {{value}}
						</div>
				</div>
				<div ng-if="item.type == 6" class="weui_cells_title">{{item.title}}</div>
				<div ng-if="item.type == 6" class="weui_cells weui_cells_form">
				<div class="weui_cell">
						<div class="weui_cell_bd weui_cell_primary">
							<textarea class="weui_textarea" ng-model="item.data" placeholder="请输入{{item.title}}" rows="2"></textarea>
							<div class="weui_textarea_counter"><span>0</span>/118</div>
						</div>
					</div>
				</div>
				<div ng-if="item.type == 7" class="weui_cells_title">{{item.title}}</div>
				<div ng-if="item.type == 7" class="weui_cells weui_cells_form" ng-init="pagedata.getlocation(item)">
					<div class="weui_cell">
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.province" class="form-control tpl-province">
							<option value="" selected="selected">省份</option>
							<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="item.data.province==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.city" class="form-control tpl-city">
							<option value="" selected="selected">城市</option>
							<option ng-repeat="(value,data) in pagedata.province[item.data.province]" value="{{value}}" ng-selected="item.data.city==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.district" class="form-control tpl-district">
							<option value="" selected="selected">区县</option>
							<option ng-repeat="(value,data) in pagedata.province[item.data.province][item.data.city]" value="{{value}}" ng-selected="item.data.district==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:28%">
							<select ng-model="item.data.street" class="form-control tpl-district">
							<option value="" selected="selected">街道</option>
							<option ng-repeat="value in pagedata.province[item.data.province][item.data.city][item.data.district]" value="{{value}}" ng-selected="item.data.street==value">{{value}}</option>
							</select>
						</div>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="item.data.xiangxi" placeholder="输入详细地址">
                </div>
				</div>
			</div>
        </div>
		<div class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">备注</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" placeholder="输入备注内容" ng-model="pagedata.post.remark">
                </div>
            </div>
        </div>
		<div ng-if="pagedata.serve.notice" class="weui_cells_text red">
				<div>{{pagedata.serve.notice}}</div>
		</div>
		<div class="fui-navbar order-create-checkout">
			<a ng-if="pagedata.post.fee>0" href="javascript:;" class="nav-item total" style="text-align:left;padding-left:0.5rem">
				<span  class="text-danger bigprice">&yen; 
					<span class="totalprice" style="font-size:1.2rem">{{price(pagedata.post.fee) || '0.00'}}</span>
				</span>
			</a>
			<a ng-if="!pagedata.order_id && pagedata.post.fee>0" href="javascript:;" class="nav-item btn btn-danger buybtn" ng-click="pagedata.pay_submit(pagedata.post,'jy_city/yuding/post/','jy_city/yudingorder//status=1')" >
				<div class="fee-tagup-nav">
					确认预定
				</div>
			</a>
			<a ng-if="!pagedata.order_id && pagedata.post.fee<=0" href="javascript:;" class="nav-item btn btn-danger buybtn" ng-click="post(pagedata.post,'jy_city/yuding/post/')" >
				<div class="fee-tagup-nav">
					确认预定
				</div>
			</a>
			<a href="javascript:;" class="nav-item btn btn-danger buybtn" ng-if="pagedata.order_id" ng-click="access_json('jy_city/yudingorder/')" >
				<div class="fee-tag-nav">
					查看订单
				</div>
			</a>
		</div>
</div>
</div>
<div id="selecttime" class="modal fade" tabindex="-1" style="z-index: 99999; display: none;">
	<div class="modal-dialog" style="width:100%;bottom:0%;left:0%;">
	<div class="modal-content" style="border-radius: 4px;">
		<div aria-hidden="true" data-dismiss="modal" class="closebtn" style="color:#ddd;top:0.2rem;right:0.2rem"><i class="icon icon-wrong" style="font-size:1.3rem;"></i></div>
		<div class="fui-line" style="width:6rem;margin:0.5rem auto 0 auto">
			<div class="text green" style="background-color:#fff" >请选择预定时间</div>
		</div>
		<div class="row margin0">
			<div class="col-xs-3">
				<div class="parent-category" id="delivery-time-parent">
					<ul>
							<li ng-class="{'active':pagedata.post.dayid==$index}" ng-repeat="(key,value) in pagedata.out_time.days"><a href="javascript:;" ng-click="pagedata.post.dayid=$index;pagedata.post.dayname=value">{{value}}</a></li>
					</ul>
				</div>
			</div>
			<div class="col-xs-9" style="padding-left:0;padding-bottom:1rem">
				<div class="children-category" id="delivery-time-children">
					<div class="children-category-wrapper">
						<ul id="category1" aria-hidden="true" data-dismiss="modal" style="height:19rem">
								<li ng-repeat="item in pagedata.out_time.times" ng-click="pagedata.post.timeid=item.id;pagedata.post.out_time=item.timev" ng-class="{'hide init-hide':(item.lasth <= pagedata.nowh && pagedata.post.dayid==0)}">
									<a href="javascript:;">{{item.timev}}</a>
								</li>
								<div class="content-empty" ng-show="pagedata.nowh >= 22 && pagedata.post.dayid==0">
									  <i class="icon jinyunicon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;"></i><br/><p style="color: #999;font-size: .75rem">当天没有服务时间段！</p>
								</div>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
	</div>
</div>
<script type="text/javascript">
scope.pagedata.pay_submit=function(post,post_url,complete_url){
	scope.post_json(post_url,post,function(result){
		if(result.order_id){
			scope.pagedata.order_id=result.order_id;
			scope.$evalAsync();
			scope.tool.pay(result.pay_id,function(res){
					if(res.type=='success'){
						scope.message('支付成功！','success',complete_url);
					}else{
						scope.message('支付失败！','success',complete_url);
					}
			});
		}
	});
}
//减少
scope.pagedata.minus=function(){
	scope.pagedata.post.total--
}
//增加
scope.pagedata.plus=function(){
	scope.pagedata.post.total++
}
scope.pagedata.selecttime=function(){
	$('#selecttime').modal();
	var merchid=scope.pagedata.post.merchid
	scope.get('jy_city/yuding/out_time/merchid='+merchid,function(res){
		scope.pagedata.out_time=res.out_time
		scope.pagedata.post.out_time=scope.pagedata.post.out_time?scope.pagedata.post.out_time:res.predict_time
		scope.$evalAsync();
	});
}
</script>